package com.example.emergency;

import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

public class RetrievePhno extends Activity{
	
	static SQLiteDatabase db=null;
	private DBHandler mDbHelper;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		  //setContentView(R.layout.empty);
		  //TextView tv=(TextView) findViewById(R.id.pppp);
		mDbHelper=new DBHandler(this);
		 mDbHelper.open();
		 
		 String phno="";
	      
		 Cursor mCursor=mDbHelper.fetchAllNotes();
	      
	       startManagingCursor(mCursor);
	       StringBuilder builder = new StringBuilder(); //we create a builder to aggregate a result
	       
	       while(mCursor.moveToNext())
	       {
	              // String name = mCursor.getString(1);  
	               phno = mCursor.getString(2);       
	       }
	      // tv.setText(phno);
	       
	       
	     Intent callIntent = new Intent(Intent.ACTION_CALL); 		
   		callIntent.setData(Uri.parse("tel:" + phno));
   		startActivity(callIntent);
		 
		 
		 
		 
	}

}
